﻿/*
 * @Author: error: git config user.name && git config user.email & please set dead value or install git
 * @Date: 2022-10-25 15:33:03
 * @LastEditors: error: git config user.name && git config user.email & please set dead value or install git
 * @LastEditTime: 2022-10-25 15:54:30
 * @FilePath: \WYW_0419_Oasis\JavaScripts\Player.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import * as odin from "odin"


export class PlayerDataInfo extends odin.DataInfo{
	hp:number	//声明每个玩家的血条变量
}

export class PlayerAll extends odin.ModuleData<PlayerDataInfo> {

	public constructor()
	{
		//调用父类构造方法并将需要管理的数据类传递给父亲
		super(PlayerDataInfo)
	}

	protected initDefaultData():void
	{
		this.dataInfo.hp=100 	//初始化血条
	}

	public setHp(hp:number)
	{
		this.dataInfo.hp=hp		//设置血量
	}

	public getHp()
	{
		return this.dataInfo.hp 	//获得血量
	}

	public subHp(hp:number)
	{
		this.dataInfo.hp-=hp	//减少血量
	}
	
}
